import 'package:yurun_smartmerchants/models/tallyallotrequest_entity.dart';

tallyallotrequestEntityFromJson(TallyallotrequestEntity data, Map<String, dynamic> json) {
	if (json['id'] != null) {
		data.id = json['id']?.toInt();
	}
	if (json['batchNo'] != null) {
		data.batchNo = json['batchNo']?.toString();
	}
	if (json['products'] != null) {
		data.products = new List<TallyallotrequestProduct>();
		(json['products'] as List).forEach((v) {
			data.products.add(new TallyallotrequestProduct().fromJson(v));
		});
	}
	return data;
}

Map<String, dynamic> tallyallotrequestEntityToJson(TallyallotrequestEntity entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['id'] = entity.id;
	data['batchNo'] = entity.batchNo;
	if (entity.products != null) {
		data['products'] =  entity.products.map((v) => v.toJson()).toList();
	}
	return data;
}

tallyallotrequestProductFromJson(TallyallotrequestProduct data, Map<String, dynamic> json) {
	if (json['id'] != null) {
		data.id = json['id']?.toInt();
	}
	if (json['tallyQuantity'] != null) {
		data.tallyQuantity = json['tallyQuantity']?.toDouble();
	}
	return data;
}

Map<String, dynamic> tallyallotrequestProductToJson(TallyallotrequestProduct entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['id'] = entity.id;
	data['tallyQuantity'] = entity.tallyQuantity;
	return data;
}